package com.ruoyi.system.service.impl;

import java.util.List;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MeetingRecordmMapper;
import com.ruoyi.system.domain.MeetingRecordm;
import com.ruoyi.system.service.IMeetingRecordmService;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.core.domain.entity.SysUser;

/**
 * 会议记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-01
 */
@Service
public class MeetingRecordmServiceImpl implements IMeetingRecordmService 
{
    @Autowired
    private MeetingRecordmMapper meetingRecordmMapper;

    /**
     * 查询会议记录
     * 
     * @param recordId 会议记录主键
     * @return 会议记录
     */
    @Override
    public MeetingRecordm selectMeetingRecordmByRecordId(Long recordId)
    {
        return meetingRecordmMapper.selectMeetingRecordmByRecordId(recordId);
    }

    /**
     * 查询会议记录列表
     * 
     * @param meetingRecordm 会议记录
     * @return 会议记录
     */
    @Override
    public List<MeetingRecordm> selectMeetingRecordmList(MeetingRecordm meetingRecordm)
    {
        // 获取当前登录用户
        SysUser currentUser = ShiroUtils.getSysUser();
        
        // 设置查询参数
        Map<String, Object> params = new HashMap<>();
        params.put("userId", currentUser.getUserId());
        params.put("ministerId", currentUser.getMinisterId());
        params.put("employeeId", currentUser.getEmployeeId());
        
        // 如果meetingRecordm的params为空，创建一个新的
        if (meetingRecordm.getParams() == null) {
            meetingRecordm.setParams(new HashMap<>());
        }
        
        // 将用户信息添加到查询参数中
        meetingRecordm.getParams().putAll(params);
        
        return meetingRecordmMapper.selectMeetingRecordmList(meetingRecordm);
    }

    /**
     * 新增会议记录
     * 
     * @param meetingRecordm 会议记录
     * @return 结果
     */
    @Override
    public int insertMeetingRecordm(MeetingRecordm meetingRecordm)
    {
        return meetingRecordmMapper.insertMeetingRecordm(meetingRecordm);
    }

    /**
     * 修改会议记录
     * 
     * @param meetingRecordm 会议记录
     * @return 结果
     */
    @Override
    public int updateMeetingRecordm(MeetingRecordm meetingRecordm)
    {
        return meetingRecordmMapper.updateMeetingRecordm(meetingRecordm);
    }

    /**
     * 批量删除会议记录
     * 
     * @param recordIds 需要删除的会议记录主键
     * @return 结果
     */
    @Override
    public int deleteMeetingRecordmByRecordIds(String recordIds)
    {
        return meetingRecordmMapper.deleteMeetingRecordmByRecordIds(Convert.toStrArray(recordIds));
    }

    /**
     * 删除会议记录信息
     * 
     * @param recordId 会议记录主键
     * @return 结果
     */
    @Override
    public int deleteMeetingRecordmByRecordId(Long recordId)
    {
        return meetingRecordmMapper.deleteMeetingRecordmByRecordId(recordId);
    }
}
